package ledrpt

class MergeController {
    def dynamicQueryService
    def merge() {
        params.SYS_QUERY_NAME='outputrpt'
        def outputrpt =dynamicQueryService.queryForList(params)
        List<Integer> list=new ArrayList<Integer>();
        List<Integer> list1=new ArrayList<Integer>();
        List<Integer> list2=new ArrayList<Integer>();
        List<Integer> list3=new ArrayList<Integer>();
        for(int i=0;i<outputrpt.size()-2;i++){
                list.add(i,outputrpt[i].TOTAL_ACTUAL_OUTPUT);
                list2.add(i,outputrpt[i].TOTAL_TARGET_OUTPUT);
        }
        for(int i=0;i<outputrpt.size();i++){
            if(outputrpt[5].TOTAL_ACTUAL_OUTPUT==null){
                list1=list;
                }
         }
        if(outputrpt[5].TOTAL_ACTUAL_OUTPUT!=null) {
            list1=outputrpt.TOTAL_ACTUAL_OUTPUT;
        }
        for(int i=0;i<outputrpt.size();i++) {
            if (outputrpt[5].TOTAL_TARGET_OUTPUT == null) {
                list3 = list2;
            }
        }
        if(outputrpt[5].TOTAL_TARGET_OUTPUT!=null) {
            list3=outputrpt.TOTAL_TARGET_OUTPUT
        }
        println(list3)
        print(123)
        params.SYS_QUERY_NAME='outqtyrpt'
        def outqtyrpt =dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME='chiptrendrpt'
        def chiptrendrpt =dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'yieldtrendrpt'
        def yieldtrendrpt = dynamicQueryService.queryForList(params)
        [outputrpt:outputrpt,outqtyrpt:outqtyrpt,chiptrendrpt:chiptrendrpt,yieldtrendrpt:yieldtrendrpt,list1:list1,list3:list3]
    }

}
